<link rel="stylesheet" href="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/css/jquery-ui-1.10.3.css" />
<script src="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/css/jquery-ui-1.10.3.js"></script>
<script>
    $(function() {
        $("#tabs").tabs();
    });
</script>
<form class="form-horizontal" action="<?= current_url() ?>" method="post" id="form-validate" >
    <div id="validation" class="row-fluid">
        <div class="span12">
            <div class="box corner-all">
                <div class="box-header grd-white color-silver-dark corner-top">
                    <div class="header-control">
                        <a data-box="collapse"><i class="icofont-caret-up"></i></a>

                    </div>
                    <span><?= lang('label_menu_link_edit') . ' ' . lang('label_menu_link_packages_details') . ' (' . $pdetails->title . ')'; ?></span>
                </div>
                <div class="box-body">

                    <fieldset>

                        <div class="control-group">
                            <label class="control-label" for="code"><?= lang('label_code') ?></label>
                            <div class="controls">
                                <input class="grd-white" name="code" id="code" placeholder="<?= lang('label_code') ?>" value="<?= (form_val('code')) ? form_val('code') : $pdetails->name; ?>" type="text" />
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label" for="type"><?= lang('label_input_type') ?></label>
                            <div class="controls">
                                <select name="type" id="type" data-form="select2">
                                    <?php
                                    $types = get_input_types();
                                    foreach ($types as $key) {
                                        ?>
                                        <option value="<?= $key ?>" <?php
                                        if (form_val('type') == $key) {
                                            echo 'selected';
                                        }elseif($pdetails->type == $key){
                                            echo 'selected';
                                        }
                                        ?>><?= $key ?></option>
                                            <?php } ?>
                                </select>
                                
                            </div>
                        </div>
                        
                        <div id="tabs">
                            <ul>
                                <?php foreach ($language as $la) { ?>
                                    <li><a href="#<?= $la->code ?>"><img src="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/images/<?= $la->code ?>.png" alt=""></a>
                                <?php } ?>
                            </ul>
                            <?php foreach ($language as $la) { ?>
                                <div class="control-group" id="<?= $la->code ?>">
                                    <label class="control-label" for="title_<?= $la->code ?>"><?= lang('label_title') ?></label>
                                    <div class="controls">
                                        <input class="grd-white" name="title_<?= $la->code ?>" id="title_<?= $la->code ?>" placeholder="<?= lang('label_title') ?>" value="<?= (form_val("title_$la->code")) ? form_val("title_$la->code") : ((isset($pdetailslanguage[$la->code])) ? $pdetailslanguage[$la->code] : '' ); ?>" type="text" />
                                    </div>
                                </div>
                            <?php } ?>
                        </div>


                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary"><li class="icon-plus" style="margin-left: 5px"></li><?= lang('label_add') ?></button>
                            <button type="button" class="btn">Cancel</button>
                        </div>
                    </fieldset>


                </div>
            </div>
        </div>
    </div>
</form>